package date.enumimpl;

/**
 * @author 张峰浦
 * @create 创建时间：2020-01-15 14:40
 */
public enum MyDayOfWeek {

    /** 星期1 */
    MONDAY(1, "MONDAY"),
    /** 星期2 */
    TUESDAY(2, "TUESDAY"),
    /** 星期3 */
    WEDNESDAY(3, "WEDNESDAY"),
    /** 星期4 */
    THURSDAY(4, "THURSDAY"),
    /** 星期5 */
    FRIDAY(5, "FRIDAY"),
    /** 星期6 */
    SATURDAY(6, "SATURDAY"),
    /** 星期7 */
    SUNDAY(7, "SUNDAY");

    private int day;

    private String value;

    private MyDayOfWeek(int day, String value) {
        this.day = day;
        this.value = value;
    }

    public static Integer getDayWeek(String value) {
        for (MyDayOfWeek dayOfWeek : MyDayOfWeek.values()) {
            if (dayOfWeek.getValue().equals(value)) {
                return dayOfWeek.getDay();
            }
        }
        return null;
    }

    public int getDay() {
        return day;
    }

    public String getValue() {
        return value;
    }
}
